<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    .active{
        color: red;
    }
  </style>
</head>
<body>
<script src="../js/vue.js"></script>
<div id="app">
  <h2 class="active">{{message}}</h2>
<!--  <h2 :class="active">{{message}}</h2>-->
  <h2 :class="{active:isActive,line:isLine}">{{message}}</h2>
  <h2 :class="getClass()">{{message}}</h2>
  <button @click="decre">按钮</button>
</div>
<script>
    const app = new Vue({
        el:'#app',
        data:{
            message:'hello vue',
            // active:'active'
            isActive:true,
            isLine:true
        },
      methods:{
          decre:function (){
            this.isActive= !this.isActive;
          },
          getClass:function (){
            return {active:this.isActive,line:this.isLine}
          }
      }

    })
</script>

</body>
</html>